import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/vue-admin-template/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/vue-admin-template/user/logout',
    method: 'post'
  })
}

export function getList(phone, pageNo, pageSize) {
  return request({
    url: `/user/list?phone=${phone}&pageNo=${pageNo}&pageSize=${pageSize}`,
    method: 'get'
  })
}

export function deleteUser(id) {
  return request({
    url: `/user/delete?id=${id}`,
    method: 'delete'
  })
}

export function registerUser(data) {
  return request({
    url: '/user/register',
    method: 'post',
    data
  })
}
